const express = require('express')
      bodyParser = require('body-parser')
      
      cookieParser = require('cookie-parser')
      app = express()
      template = require('./template')
      //引入multer模块...
      uploads = require('./multer')
      
      //引入mongoose模块...
      mongoose = require('./mongoose')
      User = mongoose.User
      Question = mongoose.Question
      Answer = mongoose.Answer
      
      //引入公共函数
      public = require('./public')
      send = public.send
      signIn = public.signIn
      
app.use(express.static('www'))
app.use(bodyParser.urlencoded({extended:true}))
app.use(cookieParser())
app.engine('.html',template.__express)
app.set('view engine','html')

//各个页面的渲染
app.use(require('./routes/index'))

//接收各个页面的路由
app.use(require('./routes/register'))
app.use(require('./routes/login'))
app.use(require('./routes/ask'))
app.use(require('./routes/answer'))


app.listen(3000,function(){
	console.log('node is ok')
})
